package com.sgb.kjwl.model.entity.self;

import android.text.TextUtils;

import com.sgb.kjwl.model.entity.transport.UserVo;

/**
 * Describe:    自营司机(列表类)
 * Author:  yangLei
 * Date:    2021/10/12
 */
public class ProprietaryDriverEntity {
    private String carNo;//车辆编号
    //	车辆认证状态（0审核中 1 审核通过 2 审核不通过）
    private Integer carState;
    private String companyName;
    private String companyNo;
    private String contact;//团队/企业联系人
    private String contactWay;//团队/企业联系方式
    private Long createTime;
    private String driverNo;//司机编号
    //司机认证状态（0审核中 1 审核通过 2 审核不通过）
    private Integer driverState;
    private Integer id;
    private Integer isDeleted;
    //挂靠/自营状态 1 邀请中 2 已拒绝 3 已同意 4 已解除
    private Integer linkState;
    //车队名字
    private String motorcadeName;
    //	车队no
    private String motorcadeNo;
    //司机姓名、车队联系人
    private String name;
    private String nameAndTel;
    private String no;
    //关联对象：1 车队 2 司机 3 车辆
    private Integer target;
    private String teamName;
    private String teamNo;
    private String telphone;
    private Integer type;//类型 1 自营 2 挂靠
    private String headImg;//司机头像

    private DriverVO driverVO;
    private UserVo userVo;
    private boolean hasMotorcade;//企业下面是否有车队

    public ProprietaryDriverEntity() {
    }

    public ProprietaryDriverEntity(Integer carState, Integer linkState, String motorcadeName, String name) {
        this.carState = carState;
        this.linkState = linkState;
        this.motorcadeName = motorcadeName;
        this.name = name;
    }

    public boolean isHasMotorcade() {
        return hasMotorcade;
    }

    public void setHasMotorcade(boolean hasMotorcade) {
        this.hasMotorcade = hasMotorcade;
    }

    public String getCarNo() {
        return carNo;
    }

    public void setCarNo(String carNo) {
        this.carNo = carNo;
    }

    public Integer getCarState() {
        return carState;
    }

    public void setCarState(Integer carState) {
        this.carState = carState;
    }

    public String getCompanyName() {
        return companyName;
    }

    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }

    public String getCompanyNo() {
        return companyNo;
    }

    public void setCompanyNo(String companyNo) {
        this.companyNo = companyNo;
    }

    public String getContact() {
        return contact;
    }

    public void setContact(String contact) {
        this.contact = contact;
    }

    public String getContactWay() {
        return contactWay;
    }

    public void setContactWay(String contactWay) {
        this.contactWay = contactWay;
    }

    public Long getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Long createTime) {
        this.createTime = createTime;
    }

    public String getDriverNo() {
        return driverNo;
    }

    public void setDriverNo(String driverNo) {
        this.driverNo = driverNo;
    }

    public Integer getDriverState() {
        return driverState;
    }

    public void setDriverState(Integer driverState) {
        this.driverState = driverState;
    }

    public DriverVO getDriverVO() {
        return driverVO;
    }

    public void setDriverVO(DriverVO driverVO) {
        this.driverVO = driverVO;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getIsDeleted() {
        return isDeleted;
    }

    public void setIsDeleted(Integer isDeleted) {
        this.isDeleted = isDeleted;
    }

    public Integer getLinkState() {
        return linkState;
    }

    public void setLinkState(Integer linkState) {
        this.linkState = linkState;
    }

    public String getMotorcadeName() {
        return motorcadeName;
    }

    public void setMotorcadeName(String motorcadeName) {
        this.motorcadeName = motorcadeName;
    }

    public String getMotorcadeNo() {
        return motorcadeNo;
    }

    public void setMotorcadeNo(String motorcadeNo) {
        this.motorcadeNo = motorcadeNo;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getNameAndTel() {
        return nameAndTel;
    }

    public void setNameAndTel(String nameAndTel) {
        this.nameAndTel = nameAndTel;
    }

    public String getNo() {
        return no;
    }

    public void setNo(String no) {
        this.no = no;
    }

    public Integer getTarget() {
        return target;
    }

    public void setTarget(Integer target) {
        this.target = target;
    }

    public String getTeamName() {
        return teamName;
    }

    public void setTeamName(String teamName) {
        this.teamName = teamName;
    }

    public String getTeamNo() {
        return teamNo;
    }

    public void setTeamNo(String teamNo) {
        this.teamNo = teamNo;
    }

    public String getTelphone() {
        return telphone;
    }

    public void setTelphone(String telphone) {
        this.telphone = telphone;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getHeadImg() {
        return headImg;
    }

    public void setHeadImg(String headImg) {
        this.headImg = headImg;
    }

    public UserVo getUserVo() {
        return userVo;
    }

    public void setUserVo(UserVo userVo) {
        this.userVo = userVo;
    }

    public String getNameAndPhoneNumber() {
        String result = "";
        if (!TextUtils.isEmpty(name)) {
            result = handleDriverName(name);
        }
        if (!TextUtils.isEmpty(telphone)) {
            if (TextUtils.isEmpty(name)) {
                result = telphone;
            } else
                result += "/" + telphone;
        }
        return result;
    }

    /**
     * 司机姓名显示逻辑
     *
     * @param driverName
     * @return
     */
    private String handleDriverName(String driverName) {
        String name = "";
        if (!TextUtils.isEmpty(driverName)) {
            if (driverName.length() == 1) {
                name = driverName;
            } else if (driverName.length() == 2) {
                name = "*" + driverName.charAt(1);
            } else {
                name = driverName.charAt(0) + "*" + driverName.substring(2);
            }
        }
        return name;
    }

}
